<!--
 * @Author: Freude Xu
 * @Date: 2021-10-05 17:38:11
 * @LastEditors: Freude Xu
 * @LastEditTime: 2021-10-05 17:43:14
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>鼠标事件</title>
</head>

<body>
    <p>这是一段文字，但是你不可以进行复制。实现过程是因为我禁用了右键菜单按钮</p>
</body>
<script>
    var p = document.querySelector('p');
    //禁止鼠标右键的默认菜单事件
    p.addEventListener('contextmenu', function(e) {
            //禁止默认事件
            e.preventDefault();
        })
        //禁止选中文字selectstart
    p.addEventListener('selectstart', function(e) {
        e.preventDefault();
    })
</script>

</html>